<template>
    <div class="page-wrap">
        <div class="margin-b-16">
            <filter-form @change="handleChange" :list="list" />
        </div>
        <custom-table autoResize rowKey="id" size="small" :loading="loading" :columns="tableColumns" :data-source="list" :pagination="paginationConfig" @change="handleTableChange">
            <template #isConnectBusiness="{ text }">
                {{ text === '1' ? '是' : '否' }}
            </template>
            <template #isWrongTimeIndex="{ text }">
                {{ text === '1' ? '是' : '否' }}
            </template>
            <template #isOutsideSystem="{ text }">
                {{ text === '1' ? '否' : '是' }}
            </template>
            <template #isCheckWorkOrder="{ text }">
                {{ text === '1' ? '是' : '否' }}
            </template>
            <template #businessCreateTime="{ text }">
                {{ $filters.dateFilter(text) }}
            </template>
            <template #versionOnlineRealTime="{ text }">
                {{ $filters.dateFilter(text) }}
            </template>
        </custom-table>
    </div>
</template>

<script lang="ts">
import CustomTable from '@/components/Table/CutomTable.vue';
import FilterForm from './filterForm.vue';
import { useRouter } from 'vue-router';
import { useTableData, useTableLoading, usePagination, useTableColumns, useTableFormSearch, useTableAction } from '@/components/Table/hooks/index';
import { useMountedAndActivated } from '@/hooks/common/useMountedAndActivated';
import { defineComponent } from 'vue';
export default defineComponent({
    name: 'zhipingGuifanxing',
    components: {
        FilterForm,
        CustomTable
    },
    setup() {
        const router = useRouter();
        const { loading, setLoading } = useTableLoading();
        const { paginationConfig, setPaginationConfig } = usePagination();
        const { columns: tableColumns } = useTableColumns('zhipingGuifanxing');
        const { list, getList, handleTableChange, setSearchQuery } = useTableData(setLoading, paginationConfig, setPaginationConfig, 'zhipingGuifanxing');
        const { handleSearch } = useTableFormSearch(setPaginationConfig, setSearchQuery, getList);
        const { showDetail } = useTableAction('zhipingGuifanxing', getList);
        const handleEdit = (id: number) => {
            router.push({
                path: '/productAnalysis/productDetail',
                query: {
                    id,
                    tab: 1
                }
            });
        };
        const handleChange = (val) => {
            setSearchQuery(val);
            handleSearch();
        };
        useMountedAndActivated(getList, false);
        return {
            handleEdit,
            list,
            tableColumns,
            loading,
            paginationConfig,
            handleTableChange,
            showDetail,
            handleChange
        };
    }
});
</script>
<style scoped lang="less">
.page-wrap {
    min-height: 100%;
    padding: 24px;
    background: #fff;
    .table-title {
        font-size: 16px;
        font-weight: bold;
    }
}
</style>